package com.yonyou.pmclouds.siteinspection.service.rmiimpl;

import com.yonyou.pmclouds.constructionlog.entity.ConstructionLogVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.basecom.ref.itf.RefCodeConst;
import com.yonyou.pmclouds.basecom.ref.itf.ReferenceCheckOfBusiness;
import com.yonyou.pmclouds.siteinspection.entity.SiteInspectionVO;
import com.yonyou.pmclouds.siteinspection.rmiitf.SiteInspectionQuery;
@Component
public class ReferenceCheckOfSiteInspectionLog implements ReferenceCheckOfBusiness{
    @Autowired
    private SiteInspectionQuery query;
    @Override
    public String[] getReferenceCode() {
        
        return new String[]{RefCodeConst.PROJECT,RefCodeConst.PROCEDURE,RefCodeConst.INSPECT_STANDARD};
    }

    @Override
    public boolean checkReferenced(String bdCode, String[] keys) throws BusinessException {
        String code = null;
        if(RefCodeConst.PROJECT.equals(bdCode)) {
            code = SiteInspectionVO.PK_PROJECT;
        } else if(RefCodeConst.PROCEDURE.equals(bdCode)) {
            code = SiteInspectionVO.PK_PROCESS;
        } else if(RefCodeConst.INSPECT_STANDARD.equals(bdCode)) {
            code = SiteInspectionVO.PK_INSPECTSTANDARD;
        } else {
            throw new BusinessException("现场检查暂未引用该档案!");
       }
       return query.queryRefByIds(code, keys);
    }

}
